package service;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
@WebServlet("/demo5")
public class ServletDemo5 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("demo5被demo4访问了");
        String uname = (String) req.getAttribute("uname");
        String pwd = (String) req.getAttribute("pwd");
        System.out.println(uname);
        System.out.println(pwd);
    }
    /*方法 获取前一个资源(前一个servlet的数据)中的数据
    * 获取前一个servle数据之前，需要前一个servlet将数据进行存储(存储在reqest域)
    * */
    /*Object getAttribute(String name)通过键获取值*/

}
